package org.tigris.atlas.examples.service.impl;

import java.lang.String;
import java.util.Collection;

import org.tigris.atlas.examples.bizobj.SimpleDomainAssembler;
import org.tigris.atlas.examples.bizobj.SimpleDomainBO;
import org.tigris.atlas.examples.service.SimpleDomainCollectionServiceResponse;
import org.tigris.atlas.examples.service.SimpleDomainServiceResponse;
import org.tigris.atlas.examples.transfer.SimpleDomain;
import org.tigris.atlas.service.IntegerServiceResponse;
import org.tigris.atlas.service.LongServiceResponse;
import org.tigris.atlas.service.StringServiceResponse;
import org.tigris.atlas.service.VoidServiceResponse;

/**
 * Service implementation class for the SimpleDomain service
 * @see org.tigris.atlas.examples.service.SimpleDomainService
 */
public class SimpleDomainServiceImpl extends SimpleDomainServiceBaseImpl {

	/**
	 * Execute the DoSomething service
	 * @see org.tigris.atlas.examples.service.SimpleDomainService#DoSomething()
	 */
	protected void doSomethingImpl(VoidServiceResponse response) {
	//TO-DO Add Business Logic Here
	
	}


	/**
	 * Execute the DoSomethingAndReturnACharacter service
	 * @see org.tigris.atlas.examples.service.SimpleDomainService#DoSomethingAndReturnACharacter()
	 */
	protected void doSomethingAndReturnACharacterImpl(StringServiceResponse response) {
	//TO-DO Add Business Logic Here
	
	}


	/**
	 * Execute the SelectAllSimpleDomainsByType service
	 * @see org.tigris.atlas.examples.service.SimpleDomainService#SelectAllSimpleDomainsByType()
	 */
	protected void selectAllSimpleDomainsByTypeImpl(String type, SimpleDomainCollectionServiceResponse response) {
		Collection bos = SimpleDomainBO.selectAllSimpleDomainsByType( type );
		Collection tos = SimpleDomainAssembler.getSimpleDomainCollection(bos);
		
		response.addSimpleDomains(tos);	
	}


	/**
	 * Execute the SelectAllSimpleDomains service
	 * @see org.tigris.atlas.examples.service.SimpleDomainService#SelectAllSimpleDomains()
	 */
	protected void selectAllSimpleDomainsImpl(SimpleDomainCollectionServiceResponse response) {
		Collection bos = SimpleDomainBO.selectAllSimpleDomains();
		Collection tos = SimpleDomainAssembler.getSimpleDomainCollection(bos);
		response.addSimpleDomains(tos);
	}


	/**
	 * Execute the EchoPlusWazzup service
	 * @see org.tigris.atlas.examples.service.SimpleDomainService#EchoPlusWazzup()
	 */
	protected void echoPlusWazzupImpl(String echoRoot, StringServiceResponse response) {
		String echoVersion = echoRoot + "WAZZUP!";
		response.setValue(echoVersion);
	}


	/**
	 * Execute the SomeBusinessOperation service
	 * @see org.tigris.atlas.examples.service.SimpleDomainService#SomeBusinessOperation()
	 */
	protected void someBusinessOperationImpl(SimpleDomain someBusinessEntity, String otherImportantData, SimpleDomainServiceResponse response) {
	//TO-DO Add Business Logic Here
	
	}


	/**
	 * Execute the GetSimpleDomainCount service
	 * @see org.tigris.atlas.examples.service.SimpleDomainService#GetSimpleDomainCount()
	 */
	protected void getSimpleDomainCountImpl(LongServiceResponse response) {
		Long count = new Long( SimpleDomainBO.selectAllSimpleDomains().size() );
		response.setValue( count );
	}


	/**
	 * Execute the Count service
	 * @see org.tigris.atlas.examples.service.SimpleDomainService#Count()
	 */
	protected void countImpl(Collection input, IntegerServiceResponse response) {
		int i = input == null ? 0: input.size();
		response.setInteger(new Integer(i));	
	}

}